<%@ page language="java" import="java.util.*" import="java.text.SimpleDateFormat" pageEncoding="UTF-8"%>
<%@ page import="com.bluesky.light.user.*" %>
<%@ page import="com.bluesky.light.staff.*" %>
<%@ page import="com.bluesky.light.order.*" %>
<%
	request.setCharacterEncoding("UTF-8");
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
	// check if the user is login
	Staff s = (Staff)session.getAttribute("staff");
	if (s == null) {
		response.sendRedirect("/light");
	}	
	String name = s.getName();
%>
<%
//System.out.println(users.size());
	String id = request.getParameter("id");
int i = Integer.parseInt(id); 
	User u = UserService.getInstance().loadById(Integer.parseInt(id));
System.out.println(id);
System.out.println(i);
System.out.println(UserService.getInstance().loadById(Integer.parseInt(id)));

	session.setAttribute("user", u);
	
	//clear old user info.
	session.removeAttribute("cart");
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>light</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link href="css/main.css" rel="stylesheet" type="text/css" />
	
  </head>
  
  <body>
	<!-- header -->
	<div id="header">
		<div id="logo"><img src="images/logo_small2.png"/></div>
	</div>
	<!-- // header -->
	<!-- nav -->
	<div id="nav">
	</div>
	<!-- // nav -->
	<!-- container -->
	<div id="container">
		<!-- contents -->
		<div id="contents">
	    	<div id="menu">
	        	<div>
	        		<div id="user_info">
	            		<img src="develop/user_icon.jpg"/> 
	            		<b>Finance</b>
	           		</div>
	           		<div>
	           		<%=name%>
	           		</div>
	            </div>
	            <div>
	            	<%SimpleDateFormat sdf = new SimpleDateFormat("EEE, yyyy-MM-dd", new Locale("US"));%><%=sdf.format(new Date())%><br></br>
	            </div>
	        	<ul>
	            	<li><a href="finance/home.jsp"><img src="images/news.png" /> Health News</a></li>
					<li><a href="finance/staff_userSearch.jsp"><img src="images/surscribe.png" />  User search</a></li>
					<li><a href="finance/staff_infoModifyInput.jsp"><img src="images/account.png" /> Account Management</a></li>   
					<li><a href="index.jsp"><img src="images/account.png" /> logout</a></li>             
	            </ul>
	        </div>
	        <div id="main-cont">
	            <div id="result">
	                <table class="resulttable" rules="all" >
	                	<caption>User List</caption>
	                    <tr>
	                        <th>No</th><th>Name</th><th>Sex</th><th>Age</th><th>Register Time</th><th>Deal</th>
	                    </tr>
	                    <tr>
	                    	<td><%=u.getId()%></td>
	                        <td><%=u.getName()%></td>
	                        <td><%=u.getSex()%></td>
	                        <td><%=u.getBirth()%></td>
	                        <td><%=u.getRdate()%></td>
	                        <td>
	                        	<a href="finance/staff_userCheckOutConfirm.jsp?action=getinfo&id=<%=u.getId()%>">Enter</a>
	                        </td>
	                    </tr>
	                </table>		
	        	</div>
	    </div>
	    <!-- // contents -->
	</div>
	<!-- // container -->
	</div>
	<div id="footer">
		<div id="bs_stdio">
	    	©2011-2011 www.bluesky.com.mo All Rights Reserved<br/>
	    	<img src="images/bluesky_logo.png" />
	    </div>
	</div>
  </body>
</html>
